﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Shape.Mvp.Commands;
using Shape.Mvp.Sample.Presenters;
using System.Diagnostics.Contracts;

namespace Shape.Mvp.Sample.Commands
{
	public class ShowPositionListCommand : ICommand
	{
		private IApplicationController _applicationController;
		private PositionListPresenter _presenter;

		public ShowPositionListCommand(
			IApplicationController applicationController,
			PositionListPresenter presenter)
		{
			Contract.Requires(applicationController != null);
			Contract.Requires(presenter != null);

			_applicationController = applicationController;
			_presenter = presenter;
		}

		public void Execute()
		{
			_presenter.Initialise();
            
			_applicationController.Show(_presenter.View).AsDialog();
		}	
	}
}